Skip to content

http2: add headersDistinct to Http2ServerRequest fixes #64060#64071

Open
Shivay-98 wants to merge 1 commit into
nodejs:mainfrom
Shivay-98:main
Open

http2: add headersDistinct to Http2ServerRequest fixes #64060#64071
Shivay-98 wants to merge 1 commit into
nodejs:mainfrom
Shivay-98:main

Conversation

@Shivay-98

Copy link
Copy Markdown

Adds headersDistinct to Http2ServerRequest to improve parity with
http.IncomingMessage.

The implementation mirrors IncomingMessage.headersDistinct by
lazily constructing a null-prototype object from rawHeaders and
preserving all header values as arrays.

Includes tests covering:

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http2
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added http2 Issues or PRs related to the http2 subsystem. needs-ci PRs that need a full CI run. labels Jun 22, 2026

@pimterry pimterry left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, thanks @Shivay-98!

There's a few JS linting issues to fix here (you can check locally with make lint). For the commit linting issue, you'll need to run git commit --amend -s to update the commit with the signed-off signature, and then force-push to update the commit here.

It'd be good to also include this change in the docs, in the compat API section in http2.md.

const kSetHeader = Symbol('setHeader');
const kAppendHeader = Symbol('appendHeader');
const kAborted = Symbol('aborted');
const kHeadersDistinct = Symbol('kHeadersDistinct');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: for symbols, generally the name doesn't have the k prefix - it's just the meaningful string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

http2 Issues or PRs related to the http2 subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

headersDistinct for http2 requests

3 participants